'use strict'

var path = require('path');
var util = require('./libs/util');
var wechat_file = path.join(__dirname,'./config/wechat.txt');
var wechat_ticket_file = path.join(__dirname,'./config/wechat_ticket.txt');

var config = {
	wechat: {
		appID: 'wx6bb10471bf34bf0e',
		appSecret: '2004fa8d62ca722b2009b2d57b42911a',
		token: 'wxexpress',
		getAccessToken: function(){
			return util.readFileAsync(wechat_file);
		},
		saveAccessToken: function(data){
			data = JSON.stringify(data);
			return util.writeFileAsync(wechat_file,data);
		},
		getTicket: function(){
			return util.readFileAsync(wechat_ticket_file);
		},
		saveTicket: function(data){
			data = JSON.stringify(data);
			return util.writeFileAsync(wechat_ticket_file,data);
		},
	}
};

module.exports = config;